#ifndef MSG_SEND_H
#define MSG_SEND_H
#include "BF7006AMxx.h"

typedef enum{
	RESPONSE_ACK  = 0x5555,  //ACK Format: 1111 1111 --> 0101 0101  0101 0101 --> 0x5555
	RESPONSE_NAK  = 0x3333,  //NAK Format: 0000 0000 --> 0011 0011  0011 0011 --> 0x3333
	RESPONSE_ND   = 0x2d2d,  //ND  Format: 0010 1101 --> 0010 1101  0010 1101 --> 0x2d2d
	RESPONSE_ATN  = 0x3535,  //ATN Format: 0011 0011 --> 0011 0101  0011 0101 --> 0x3535
}RESPONSE_T;

typedef enum{
	FSK_TX_DATA_NOT_AVAILABLE_PACK = 0x00,
	FSK_TX_IDENTIFICATION_PACKET   = 0x30,
	FSK_TX_CAPABILITY_PACKET       = 0x31,
}FSK_PACKET_T;

typedef struct{
	uint8_t status;
#define FSK_STATUS_IDLE  1
#define FSK_STATUS_BUSY  2
	uint8_t msg_type;
#define TYPE_MESSAGE  1
#define TYPE_RESPONSE 2
	RESPONSE_T response;
	uint8_t operation_freq;     
#define FREQUENCY_OP  0       // f_op
#define FREQUENCY_MOD 1      // f_mod
}FSK_STATUS_T;

typedef struct{
	uint8_t header;
	#define MAX_MESSAGE  3
	uint8_t message[MAX_MESSAGE];
	uint8_t checksum;
	uint8_t msg_size;
}SEND_DATA_PACKET_T;

typedef struct{
	bool h_flg;    //header have send flag
	bool msg_flg;   // msg have send flag
	bool cs_flg;    // checksum have send flag
	SEND_DATA_PACKET_T	packet;  //msg packet
}MSG_PACKET_T;

void power_tx_response(RESPONSE_T type);
void power_tx_send_msg(SEND_DATA_PACKET_T *msg);
void fsk_status_init(void);
#endif
